﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _20170119_Stack
{
    class Stack
    {
        private ArrayList arrayList = new ArrayList();

        public void Push(object o)
        {
            arrayList.Add(o);
        }

        public object Pop()
        {
            if (arrayList.Count == 0)
                throw new NullReferenceException();
            object o = arrayList[arrayList.Count - 1];
            arrayList.Remove(o);
            return o;
        }

        public void Clear()
        {
            arrayList.Clear();
        }
    }
}
